
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>吃糖果</title>
<meta name="keywords" content="吃糖果html5游戏" />
<meta name="description" content="吃糖果html5游戏" />
<link rel="apple-touch-icon" href="icon.png" />
<link rel="shortcut icon" href="icon.png" />
<link rel="icon" href="icon.png" />
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">


<script type="text/javascript" src="./lib/soundjs.min.js"></script>
<script type="text/javascript" src="./Pinata.js"></script>
<script type="text/javascript">
function HTML5API_levelStarted() { window.HTML5API && HTML5API.levelStarted && HTML5API.levelStarted(); }
function HTML5API_levelEnded() { window.HTML5API && HTML5API.levelEnded && HTML5API.levelEnded(); }
function HTML5API_preloaderStarted() { window.HTML5API && HTML5API.preloaderStarted && HTML5API.preloaderStarted(); }
function HTML5API_preloaderEnded() { window.HTML5API && HTML5API.preloaderEnded && HTML5API.preloaderEnded(); }
function HTML5API_showStartButton() { return window.HTML5API && HTML5API.showStartButton && HTML5API.showStartButton(); }
function HTML5API_getUserId() { if(window.HTML5API && HTML5API.getUserId) return HTML5API.getUserId(); }
function HTML5API_isAdPlaying() { if(window.HTML5API && HTML5API.isAdPlaying) return HTML5API.isAdPlaying(); }
function HTML5API_onAdStart(func) { return window.HTML5API && HTML5API.onAdStart && HTML5API.onAdStart(func); }
function HTML5API_onAdComplete(func) { return window.HTML5API && HTML5API.onAdComplete && HTML5API.onAdComplete(func); }
function HTML5API_showMidroll() { return window.HTML5API && HTML5API.showMidroll && HTML5API.showMidroll(); }
function HTML5API_setWidgetState(params) { window.HTML5API && HTML5API.setWidgetState && HTML5API.setWidgetState(params); }
</script>
<script>
window.addEventListener ("touchmove", function (event) { event.preventDefault (); }, false);
if (typeof window.devicePixelRatio != 'undefined' && window.devicePixelRatio > 2) {
var meta = document.getElementById ("viewport");
meta.setAttribute ('content', 'width=device-width, initial-scale=' + (2 / window.devicePixelRatio) + ', user-scalable=0');
}
</script>
<style>
html,body { margin: 0; padding: 0; height: 100%; }
#openfl-content { background: #000000; width: 100%; height: 100%; z-index: 1; overflow: visible;}
canvas { display: inherit; margin: 0 auto !important;}
</style>
</head>
<body>
<div id="openfl-content"></div>
<script type="text/javascript">
// Embed application, fit to best window size
var getSize = function() {
var orientation = "portrait";
var element = document.getElementById("openfl-content");
var clientWidth = element.clientWidth;
var clientHeight = element.clientHeight;
var minWidth = 320 ;
var minHeight = 480 ;
var finalWidth = minWidth;
var finalHeight = minHeight;
if (orientation == "portrait")
{
var currRatio = clientHeight / clientWidth;
var minRatio = minHeight / finalWidth;
var maxHeight = 568 ;
if (maxHeight == null) maxHeight = finalHeight;
var maxRatio = maxHeight / finalWidth;
if (currRatio <= minRatio)
{
finalHeight = minHeight;
}
else if (currRatio >= maxRatio)
{
finalHeight = maxHeight;
}
else
{
finalHeight = Math.floor(finalWidth * currRatio);
}
}
else if (orientation == "landscape")
{
var currRatio = clientWidth / clientHeight;
var minRatio = minWidth / finalHeight;
var maxWidth = null ;
console.log(maxWidth);
if (maxWidth == null) maxWidth = finalWidth;
var maxRatio = maxWidth / finalHeight;
if (currRatio <= minRatio)
{
finalWidth = minWidth;
}
else if (currRatio >= maxRatio)
{
finalWidth = maxWidth;
}
else
{
finalWidth = Math.floor(finalHeight * currRatio);
}
}
return {width: finalWidth, height: finalHeight};
}
var size = getSize();
lime.embed ("openfl-content", size.width, size.height, "000000");
// Resize document width to fix Samsung Galaxy stock-browser render freeze on touch bug:
if (/Android/.test(navigator.userAgent) && !(/Chrome/.test(navigator.userAgent)))
{
var ds = document.documentElement.style;
var origW = ds.width;
ds.width = "101%";
setTimeout(function() { ds.width = origW; }, 500);
} 
</script>
</body>
</html>
